home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
c
/
tcdebug.zip
/
TCDEBUG.DOC
< prev
next >
Wrap
Text File
|
1988-05-08
|
38KB
|
1,255 lines
May 7, 1988
TCdebug Version 1.01
(C) Copyright 1987 by L. David Baldwin.
All Rights Reserved.
Further copyright information given below
OVERVIEW
TCdebug is an experimental source code debugger for use in debugging Turbo
C (tm) Programs on the IBM-PC (tm). Its goal is to allow source code
debugging in all of Turbo C's memory models and with most of the possible
compile and link options. TCdebug allows you to:
1. View your source code (and, optionally, the assembly language
code) while debugging.
2. Trace the operation of your program by source code lines or by
assembly language instructions.
3. Insert breakpoints in your program by function name, by line
number, or hexadecimal address.
4. Examine (and change) simple global variables by symbolic name.
Local variables may also be examined and changed, but require that
the proper displacement on the stack be known.
5. Set up a Watch window to keep continuous tabs on a variable.
6. Profile your program to find those portions which contribute most
to the execution time.
TCdebug is designed exclusively for debugging Turbo C programs. It should
not be used on programs generated by other compilers.
SYSTEM REQUIREMENTS
1. An IBM-PC, AT, or compatible. Screen compatibility is a must.
2. PC-DOS 2.0 or above.
3. Approximately 135k more memory than would normally be required to
run the program to be tested.
PREPARATION
TCdebug requires that a Map file for your program be present to supply
information on the program symbols and line number locations. When
compiling and linking with TC, the options can be set with O/C/C/L and
O/L/M/P. With TCC use -M and -y.
1
It is also highly desirable that the program to be tested be compiled with
the 'standard stack frame' option on. Using TC, set this option with
O/C/C/S. With TCC, use -k (The manual says -Y but that's apparently a
typo).
When starting a debugging session, the following files should be on the
default drive:
PROG.EXE (or, optionally, .COM for the Tiny Model)
PROG.MAP the map file
Any C source files which will be accessed during the debugging session
should also be on the default drive or on Paths specified in the DOS PATH.
OPERATION
TCdebug may be started by entering the filename of the program to be
debugged and any parameters which it requires on the command line, as:
TCdebug PROG <other stuff>
Here, PROG is the name of the program to be tested with EXE being the
default extension. <other stuff> will be passed on to PROG as its command
line when execution begins. If TCdebug is called without parameters, a
request will be made for them.
When execution begins, TCdebug loads the Map file, the EXE file and reports
some facts about the program. Note should be made of whether pointers are
regarded as Near or Far by default as this will be important when
displaying pointers later.
After "hitting any key", the program is executed to "main()" and the
debugging screen appears. The debugging screen is divided into two parts.
The lower section is the command and data section. The '*' is a prompt for
one of the commands described later. The top part of the screen displays
the program source code text which at this point will be centered at the
first statement in main(). Source code line numbers appear at the left
with the current line (the one to be executed next) being highlighted.
Dividing the two portions of the debugging screen is a line which shows the
name of the source file presently displayed.
Two keys which can be tried at this point are the F9 and F10 keys. The
F9 key toggles into and out of the assembly mode. When in assembly mode,
the assembly language instructions of the program are displayed with the
source code lines interspersed. The F10 key toggles between the debugger
screen and the screen which receives program output.
2
SPECIAL KEYS FOR VIEWING TEXT
The following keys may be used to change the text being displayed:
Pg Up
Pg Dn Move the display up or down one page.
^Pg Up
^Pg Dn Move to the start or end of the current file.
Up arrow
Down arrow Scroll up or down one line.
^Left Arrow (with Scroll Lock on)
^Right Arrow (with Scroll Lock on)
Scroll horizontally left and right.
F9 key Toggle in and out of assembly mode.
F10 key Toggle between the debug screen and the screen
of the program under test.
Alt-U Move dividing line up one line.
Alt-D Move dividing line down one line.
Note that the toggling of the Scroll Lock key effects the action of some of
the special keys. The text display may also be changed using the View
command described later.
COMMAND EDITOR
Commands are entered at the '*' prompt. When entering commands, the
following keys may used to edit the command: (They perform the same
functions as they do in the Turbo C editor.)
^A,^S,^D,^F,^G,^T,^H,^V,^Y,LFARW,RTARW,^LFARW,^RTARW,
Ins, Del, Backspace
The Insert mode (default) is indicated by a slightly fatter cursor. The
cursor is normal in the Overwrite mode.
In addition, a stack of the last 6 commands (those having more than 3
characters) is maintained. The F3 key accesses the stored commands from
the most recent to the oldest and the F5 key accesses them in the reverse
order. These old commands may be used as is or may be modified by editing
them.
Note that commands are not acted upon until the Enter key is hit. (The
cursor does not have to be at the line end to enter the command.)
3
COMMAND PARAMETERS
TCdebug uses one or two letter commands. The command is often followed by
one or more parameters. Parameters are delimited from the command and each
other using spaces. The one exception to this is the format parameter
which is preceded by a comma. The parameters which may be used are:
<Symbol>
A C source code symbol representing a function name or variable as
appropriate. The leading underbar added by the compiler has been
stripped off, so symbols are entered exactly as used in the source
program. Case is significant (unless the non case sensitive link
option was selected).
The special symbols, _AX, _AL, _BX, etc. may be used to refer to the
hardware registers.
A special symbol, rtn (or RTN), refers to the return address of the
current function. For this symbol to function reliably, the program
should be compiled with the 'standard stack frame' option on.
Currently, this symbol can only be accessed if the current CS:IP is on
an exact source line number.
Examples:
V rtn Find out who called this function.
G RTN Execute the remainder of this function, return to caller.
<Line Number>
Line numbers are entered as <filename>\<number> as:
myprog.c\345
In most cases, the <filename> part can be dropped. An entry of the
form
\345
implies line number 345 in the currently displayed source file.
(Currently, the '\' also may be dropped and a simple decimal entry will
do. However, the '\' may be required in future versions.)
<Hexaddress>